package com.baba.vote.dto.request;

import com.baba.vote.constant.VoteSceneConstant;
import com.baba.vote.pojo.VoteAct;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @author moxinHuoHuo
 * @create 2020/4/7 上午1:27
 */
@Data
public class VoteActBo {

  @ApiModelProperty("投票类型")
  private Integer type;

  @ApiModelProperty("参加本场投票人数")
  private Integer peopleNum;

  @ApiModelProperty("本场投票的选项数目")
  private Integer votingNum;

  @ApiModelProperty("发起投票地点的经度")
  private Double longitude;

  @ApiModelProperty("发起投票地点的纬度")
  private Double latitude;

  @ApiModelProperty("投票选项的内容")
  List<VoteItemBo> votingContents;

  public VoteAct doForward() {

    VoteAct voteAct = new VoteAct();

    voteAct.setType(type);
    voteAct.setPeopleNum(peopleNum);
    voteAct.setVotingNum(votingNum);
    voteAct.setVoted(0);
    voteAct.setStatus(true);
    voteAct.setLongitude(longitude);
    voteAct.setLatitude(latitude);

    return voteAct;
  }

//  private void setType(VoteAct voteAct) {
//    //代表实时结果功能启用
//    if ((type & VoteSceneConstant.REALTIME) != 0){
//      voteAct.setType(VoteSceneConstant.REALTIME);
//    }
//    //代表匿名结果功能启用
//    if ((type & VoteSceneConstant.ANONYMOUS) != 0){
//      voteAct.setType(VoteSceneConstant.ANONYMOUS);
//    }
//    //代表在场投票功能启用
//    if ((type & VoteSceneConstant.LOCATION) != 0){
//      voteAct.setType(VoteSceneConstant.LOCATION);
//    }
//  }

}
